from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time

# 设置超时时间
driver = webdriver.Chrome()
driver.implicitly_wait(10)
driver.get('http://www.baidu.com')
search = WebDriverWait(driver, 5, 0.6).until(EC.presence_of_element_located((By.ID, 'kw')))
search.send_keys("hello")
search.send_keys(Keys.ENTER)
